Skip to content

feat: add MiniMax provider support#9

Open
octo-patch wants to merge 1 commit intocodeaashu:mainfrom
octo-patch:feature/add-minimax-provider
Open

feat: add MiniMax provider support#9
octo-patch wants to merge 1 commit intocodeaashu:mainfrom
octo-patch:feature/add-minimax-provider

Conversation

@octo-patch
Copy link
Copy Markdown

@octo-patch octo-patch commented Apr 6, 2026

Summary

This PR adds MiniMax as a new LLM provider for Claude Code, following the same pattern as the existing Bedrock/Vertex/Foundry providers.

Changes

  • src/utils/model/providers.ts: Added 'minimax' to the APIProvider type union; added CLAUDE_CODE_USE_MINIMAX env var check in getAPIProvider(); isFirstPartyAnthropicBaseUrl() correctly returns false for MiniMax provider
  • src/utils/model/configs.ts: Added MINIMAX_M2_7_CONFIG and MINIMAX_M2_7_HIGHSPEED_CONFIG model configs; relaxed ModelConfig type to allow optional minimax key (existing Claude configs are unaffected)
  • src/utils/model/modelStrings.ts: Updated getBuiltinModelStrings() to fall back to firstParty value for model configs that don't define a minimax variant
  • src/services/api/client.ts: Added MiniMax client creation using the Anthropic-compatible API endpoint
  • src/utils/model/__tests__/minimax.test.ts: 15 unit tests covering provider selection, model configs, parameter filtering, and API constraints

Usage

export CLAUDE_CODE_USE_MINIMAX=1
export MINIMAX_API_KEY=<your-minimax-api-key>
# Optional: override base URL (default: https://api.minimax.io/anthropic)
export MINIMAX_BASE_URL=https://api.minimax.io/anthropic

Models

Model ID Description
MiniMax-M2.7 Peak Performance. Ultimate Value. Master the Complex
MiniMax-M2.7-highspeed Same performance, faster and more agile

API References

Test Results

bun test src/utils/model/__tests__/minimax.test.ts
 15 pass
 0 fail

Summary by CodeRabbit

  • New Features

    • Added MiniMax as a new supported AI provider enabling additional model access.
    • Introduced two MiniMax models: M2.7 and M2.7 HighSpeed for expanded model selection.
  • Tests

    • Added comprehensive test suite validating MiniMax provider behavior and model configuration mappings.

- Add 'minimax' to APIProvider type in providers.ts
- Add CLAUDE_CODE_USE_MINIMAX env var for provider selection
- Add isFirstPartyAnthropicBaseUrl() returns false for MiniMax provider
- Add MINIMAX_M2_7_CONFIG and MINIMAX_M2_7_HIGHSPEED_CONFIG model configs
- Register minimaxM27 and minimaxM27hs in ALL_MODEL_CONFIGS
- Relax ModelConfig type to allow optional minimax key
- Update getBuiltinModelStrings() to fall back to firstParty for models without minimax key
- Add MiniMax client creation in getAnthropicClient() using Anthropic-compatible endpoint
- Support MINIMAX_API_KEY and MINIMAX_BASE_URL env vars
- Add unit tests for MiniMax provider (15 tests, all passing)

Set CLAUDE_CODE_USE_MINIMAX=1 and MINIMAX_API_KEY=<key> to use MiniMax models.
Default base URL: https://api.minimax.io/anthropic (Anthropic-compatible API)
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 6, 2026

📝 Walkthrough

Walkthrough

This pull request adds support for MiniMax as a new API provider. It introduces environment variable-based provider selection, adds MiniMax model configurations (M2.7 and M2.7 HighSpeed), updates provider type definitions, modifies client configuration logic, and includes comprehensive test coverage for the new functionality.

Changes

Cohort / File(s) Summary
API Client Configuration
src/services/api/client.ts
Added early return path in getAnthropicClient() to construct an Anthropic client with MiniMax credentials and base URL when CLAUDE_CODE_USE_MINIMAX is set, bypassing subsequent token/OAuth configuration.
Provider Type and Resolution Logic
src/utils/model/providers.ts
Extended APIProvider union type to include 'minimax'. Updated getAPIProvider() to return 'minimax' when CLAUDE_CODE_USE_MINIMAX is truthy. Modified isFirstPartyAnthropicBaseUrl() to immediately return false for MiniMax provider.
Model Configuration
src/utils/model/configs.ts, src/utils/model/modelStrings.ts
Restructured ModelConfig type to require providers `'firstParty'
Test Suite
src/utils/model/__tests__/minimax.test.ts
Added comprehensive test suite covering MiniMax provider behavior, environment variable snapshots, provider selection precedence, base URL validation, model config registration, model string resolution, and temperature-range constraints.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰✨ A MiniMax arrives with config so sweet,
Provider selection, the logic is neat!
New models dance (M2.7 takes the stage),
Tests guard the truth on every page—
The rabbit hops forward with flags flying high! 🚀

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add MiniMax provider support' directly and clearly summarizes the main change: introducing MiniMax as a new LLM provider with corresponding configuration and client setup.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (2)
src/utils/model/__tests__/minimax.test.ts (1)

109-114: Base URL test doesn't exercise actual client code.

This test hardcodes the expected URL string rather than importing it from client.ts or a shared constant. If the default URL changes in client.ts, this test won't catch the drift.

Proposed improvement

Consider extracting the default URL to a shared constant:

// In a shared constants file or client.ts
export const MINIMAX_DEFAULT_BASE_URL = 'https://api.minimax.io/anthropic'

// In test
import { MINIMAX_DEFAULT_BASE_URL } from '../../../services/api/client.js'
expect(MINIMAX_DEFAULT_BASE_URL).toContain('api.minimax.io')
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/utils/model/__tests__/minimax.test.ts` around lines 109 - 114, The test
in minimax.test.ts hardcodes the expected URL string instead of asserting the
actual client default; update the test to import and use the canonical constant
(e.g. MINIMAX_DEFAULT_BASE_URL) from the client module (services/api/client or
client.ts) or a shared constants file, then assert that MINIMAX_DEFAULT_BASE_URL
contains 'api.minimax.io' and does not contain 'api.minimax.chat' so changes in
the client default fail the test.
src/utils/model/configs.ts (1)

86-100: MiniMax configs use identical model IDs across all providers.

Both MINIMAX_M2_7_CONFIG and MINIMAX_M2_7_HIGHSPEED_CONFIG use the same 'MiniMax-M2.7' / 'MiniMax-M2.7-highspeed' string for firstParty, bedrock, vertex, foundry, and minimax keys.

This seems intentional (MiniMax models only available via MiniMax API), but if a user accidentally sets both CLAUDE_CODE_USE_BEDROCK=1 and selects a MiniMax model, requests will be sent to Bedrock with an invalid model ID.

Consider adding a runtime guard or documenting that MiniMax models are only valid with the MiniMax provider.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/utils/model/configs.ts` around lines 86 - 100, MINIMAX_M2_7_CONFIG and
MINIMAX_M2_7_HIGHSPEED_CONFIG map the same MiniMax-only model IDs across all
providers which can cause invalid requests if a non-MiniMax provider (e.g.,
Bedrock via CLAUDE_CODE_USE_BEDROCK) is selected; add a runtime guard in the
model-resolution/selection path (where provider is determined) to validate that
when modelId comes from MINIMAX_M2_7_CONFIG or MINIMAX_M2_7_HIGHSPEED_CONFIG the
selected provider is MiniMax (or throw/return a clear error), or alternatively
short-circuit and force the provider to MiniMax for those model mappings;
reference the constants MINIMAX_M2_7_CONFIG and MINIMAX_M2_7_HIGHSPEED_CONFIG
and the function that resolves provider/model selection to implement this
validation and error handling.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/services/api/client.ts`:
- Around line 300-308: The code path that constructs minimaxConfig when
isEnvTruthy(process.env.CLAUDE_CODE_USE_MINIMAX) does not validate
process.env.MINIMAX_API_KEY, so an undefined apiKey can be passed into new
Anthropic; add an early check before building minimaxConfig (e.g., in the same
if block) to verify process.env.MINIMAX_API_KEY is present and otherwise throw a
clear Error or call processLogger.error + process.exit(1); ensure the check
references process.env.MINIMAX_API_KEY and runs prior to creating
minimaxConfig/new Anthropic so any startup failure is explicit.

In `@src/utils/model/__tests__/minimax.test.ts`:
- Around line 116-141: The tests are asserting parameter filtering
(UNSUPPORTED_PARAMS: 'top_k','stop_sequences','service_tier') and temperature
validation (isValidTemperature: t > 0 && t <= 1.0) but those checks only live in
the tests; implement them in the production request flow by adding a
sanitizeMiniMaxParams(params) function that removes any keys in the
UNSUPPORTED_PARAMS set and a validateMiniMaxTemperature(t) helper that enforces
(0, 1.0], then call these from the MiniMax request builder/handler (e.g.,
wherever requests are prepared/sent—prepareRequest/buildRequest/sendRequest in
the MiniMax client) so all outgoing requests are filtered/validated
consistently; surface clear errors when validation fails.

In `@src/utils/model/configs.ts`:
- Around line 3-4: ModelConfig currently makes 'minimax' optional which causes
CLAUDE_OPUS_4_6_CONFIG[getAPIProvider()] to be undefined when getAPIProvider()
returns 'minimax', breaking getHardcodedTeammateModelFallback; fix by ensuring a
defined fallback or adding minimax entries: either add a 'minimax' key to all
Claude configs (e.g., CLAUDE_OPUS_4_6_CONFIG) with the appropriate ModelName, or
change getHardcodedTeammateModelFallback to safely resolve provider like const
provider = getAPIProvider(); return CLAUDE_OPUS_4_6_CONFIG[provider] ??
CLAUDE_OPUS_4_6_CONFIG.firstParty so it never returns undefined. Ensure
references to ModelConfig, minimax, CLAUDE_OPUS_4_6_CONFIG and
getHardcodedTeammateModelFallback are updated accordingly.

In `@src/utils/model/providers.ts`:
- Line 4: The APIProvider union lacks 'minimax' handling leading to silent
feature disablement; update all provider checks to explicitly include or exclude
'minimax' so behavior is deterministic: in
src/tools/WebSearchTool/WebSearchTool.ts update the feature gating (the logic
around web search enablement) to either include 'minimax' alongside
'firstParty', 'vertex', and 'foundry' if MiniMax supports web search, or
explicitly handle minimax by returning false with a clear comment and a
UI-facing flag; in src/utils/betas.ts (structured outputs check) and
src/utils/thinking.ts (adaptive thinking check) modify the conditional logic
that currently checks provider against 'firstParty' and 'foundry' to also
consider 'minimax' where appropriate, or add explicit negative branches for
'minimax' plus a comment and a hook to surface unsupported-state to the UI; make
sure to reference the APIProvider type so changes stay consistent.

---

Nitpick comments:
In `@src/utils/model/__tests__/minimax.test.ts`:
- Around line 109-114: The test in minimax.test.ts hardcodes the expected URL
string instead of asserting the actual client default; update the test to import
and use the canonical constant (e.g. MINIMAX_DEFAULT_BASE_URL) from the client
module (services/api/client or client.ts) or a shared constants file, then
assert that MINIMAX_DEFAULT_BASE_URL contains 'api.minimax.io' and does not
contain 'api.minimax.chat' so changes in the client default fail the test.

In `@src/utils/model/configs.ts`:
- Around line 86-100: MINIMAX_M2_7_CONFIG and MINIMAX_M2_7_HIGHSPEED_CONFIG map
the same MiniMax-only model IDs across all providers which can cause invalid
requests if a non-MiniMax provider (e.g., Bedrock via CLAUDE_CODE_USE_BEDROCK)
is selected; add a runtime guard in the model-resolution/selection path (where
provider is determined) to validate that when modelId comes from
MINIMAX_M2_7_CONFIG or MINIMAX_M2_7_HIGHSPEED_CONFIG the selected provider is
MiniMax (or throw/return a clear error), or alternatively short-circuit and
force the provider to MiniMax for those model mappings; reference the constants
MINIMAX_M2_7_CONFIG and MINIMAX_M2_7_HIGHSPEED_CONFIG and the function that
resolves provider/model selection to implement this validation and error
handling.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a315387a-98cc-4f25-92b7-30942a56755a

📥 Commits

Reviewing files that changed from the base of the PR and between 5bad4a3 and cbc89e3.

📒 Files selected for processing (5)
  • src/services/api/client.ts
  • src/utils/model/__tests__/minimax.test.ts
  • src/utils/model/configs.ts
  • src/utils/model/modelStrings.ts
  • src/utils/model/providers.ts

Comment on lines +300 to +308
if (isEnvTruthy(process.env.CLAUDE_CODE_USE_MINIMAX)) {
const minimaxConfig: ConstructorParameters<typeof Anthropic>[0] = {
apiKey: process.env.MINIMAX_API_KEY,
baseURL: process.env.MINIMAX_BASE_URL ?? 'https://api.minimax.io/anthropic',
...ARGS,
...(isDebugToStdErr() && { logger: createStderrLogger() }),
}
return new Anthropic(minimaxConfig)
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Missing validation for MINIMAX_API_KEY.

When CLAUDE_CODE_USE_MINIMAX is set but MINIMAX_API_KEY is missing, undefined is passed to the Anthropic SDK's apiKey option. This will likely cause a cryptic error at request time rather than a clear startup error.

Proposed fix
  if (isEnvTruthy(process.env.CLAUDE_CODE_USE_MINIMAX)) {
+   if (!process.env.MINIMAX_API_KEY) {
+     throw new Error('MINIMAX_API_KEY environment variable is required when using MiniMax provider')
+   }
    const minimaxConfig: ConstructorParameters<typeof Anthropic>[0] = {
      apiKey: process.env.MINIMAX_API_KEY,
      baseURL: process.env.MINIMAX_BASE_URL ?? 'https://api.minimax.io/anthropic',
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (isEnvTruthy(process.env.CLAUDE_CODE_USE_MINIMAX)) {
const minimaxConfig: ConstructorParameters<typeof Anthropic>[0] = {
apiKey: process.env.MINIMAX_API_KEY,
baseURL: process.env.MINIMAX_BASE_URL ?? 'https://api.minimax.io/anthropic',
...ARGS,
...(isDebugToStdErr() && { logger: createStderrLogger() }),
}
return new Anthropic(minimaxConfig)
}
if (isEnvTruthy(process.env.CLAUDE_CODE_USE_MINIMAX)) {
if (!process.env.MINIMAX_API_KEY) {
throw new Error('MINIMAX_API_KEY environment variable is required when using MiniMax provider')
}
const minimaxConfig: ConstructorParameters<typeof Anthropic>[0] = {
apiKey: process.env.MINIMAX_API_KEY,
baseURL: process.env.MINIMAX_BASE_URL ?? 'https://api.minimax.io/anthropic',
...ARGS,
...(isDebugToStdErr() && { logger: createStderrLogger() }),
}
return new Anthropic(minimaxConfig)
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/services/api/client.ts` around lines 300 - 308, The code path that
constructs minimaxConfig when isEnvTruthy(process.env.CLAUDE_CODE_USE_MINIMAX)
does not validate process.env.MINIMAX_API_KEY, so an undefined apiKey can be
passed into new Anthropic; add an early check before building minimaxConfig
(e.g., in the same if block) to verify process.env.MINIMAX_API_KEY is present
and otherwise throw a clear Error or call processLogger.error + process.exit(1);
ensure the check references process.env.MINIMAX_API_KEY and runs prior to
creating minimaxConfig/new Anthropic so any startup failure is explicit.

Comment on lines +116 to +141
it('filters unsupported parameters for Anthropic-compatible API', () => {
const UNSUPPORTED_PARAMS = new Set(['top_k', 'stop_sequences', 'service_tier'])
const input: Record<string, unknown> = {
model: 'MiniMax-M2.7',
messages: [{ role: 'user', content: 'hi' }],
top_k: 40,
stop_sequences: ['END'],
temperature: 1.0,
}
const filtered = Object.fromEntries(
Object.entries(input).filter(([k]) => !UNSUPPORTED_PARAMS.has(k)),
)
expect('top_k' in filtered).toBe(false)
expect('stop_sequences' in filtered).toBe(false)
expect('temperature' in filtered).toBe(true)
expect('model' in filtered).toBe(true)
})

it('validates temperature range (0.0, 1.0] — 0 is invalid for MiniMax', () => {
const isValidTemperature = (t: number) => t > 0 && t <= 1.0
expect(isValidTemperature(1.0)).toBe(true)
expect(isValidTemperature(0.5)).toBe(true)
expect(isValidTemperature(0.0)).toBe(false)
expect(isValidTemperature(1.1)).toBe(false)
})
})
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify no parameter filtering exists for MiniMax in client.ts
rg -nA20 "CLAUDE_CODE_USE_MINIMAX" src/services/api/client.ts

Repository: codeaashu/claude-code

Length of output: 1063


🏁 Script executed:

#!/bin/bash
# Find where ARGS is defined in client.ts
rg -nB10 "...ARGS" src/services/api/client.ts | head -40

Repository: codeaashu/claude-code

Length of output: 1637


🏁 Script executed:

#!/bin/bash
# Search for any parameter filtering logic in the codebase for MiniMax
rg -n "UNSUPPORTED_PARAMS|top_k|stop_sequences|service_tier" src/services/api/ --type ts

Repository: codeaashu/claude-code

Length of output: 309


🏁 Script executed:

#!/bin/bash
# Check if there's request filtering/interceptor logic
fd . src/services/api -name "*intercept*" -o -name "*filter*" -o -name "*middleware*"

Repository: codeaashu/claude-code

Length of output: 295


🏁 Script executed:

#!/bin/bash
# Look for the complete test file to understand context
wc -l src/utils/model/__tests__/minimax.test.ts

Repository: codeaashu/claude-code

Length of output: 110


🏁 Script executed:

#!/bin/bash
# Get ARGS definition from client.ts
sed -n '141,160p' src/services/api/client.ts

Repository: codeaashu/claude-code

Length of output: 803


🏁 Script executed:

#!/bin/bash
# Read the entire minimax.test.ts to understand test context
cat -n src/utils/model/__tests__/minimax.test.ts

Repository: codeaashu/claude-code

Length of output: 6239


🏁 Script executed:

#!/bin/bash
# Search for any actual usage of parameter filtering or validation for MiniMax
rg -n "top_k|stop_sequences" src/services/api/ --type ts -B2 -A2

Repository: codeaashu/claude-code

Length of output: 47


🏁 Script executed:

#!/bin/bash
# Search for any validation functions or interceptor for MiniMax specifically
rg -n "MiniMax|minimax" src/services/api/client.ts --type ts -B5 -A10 | grep -E "(filter|validate|intercept)" -B5 -A5

Repository: codeaashu/claude-code

Length of output: 47


Tests document constraints not enforced by the client.

The tests at lines 116-132 and 134-140 define parameter filtering and temperature validation as inline utility logic, but these functions are never imported or called in production. They appear to document MiniMax API constraints (unsupported parameters top_k, stop_sequences, service_tier; temperature range (0, 1.0]) rather than verify client behavior.

If MiniMax requires this filtering/validation, implement it in the client request handler or request interceptor. Otherwise, clarify the test intent or remove these tests to avoid confusion about what the client actually enforces.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/utils/model/__tests__/minimax.test.ts` around lines 116 - 141, The tests
are asserting parameter filtering (UNSUPPORTED_PARAMS:
'top_k','stop_sequences','service_tier') and temperature validation
(isValidTemperature: t > 0 && t <= 1.0) but those checks only live in the tests;
implement them in the production request flow by adding a
sanitizeMiniMaxParams(params) function that removes any keys in the
UNSUPPORTED_PARAMS set and a validateMiniMaxTemperature(t) helper that enforces
(0, 1.0], then call these from the MiniMax request builder/handler (e.g.,
wherever requests are prepared/sent—prepareRequest/buildRequest/sendRequest in
the MiniMax client) so all outgoing requests are filtered/validated
consistently; surface clear errors when validation fails.

Comment on lines +3 to +4
export type ModelConfig = Record<'firstParty' | 'bedrock' | 'vertex' | 'foundry', ModelName> &
Partial<Record<'minimax', ModelName>>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find direct config indexing with getAPIProvider() that may return undefined for minimax
rg -nP '\b[A-Z_]+_CONFIG\s*\[\s*getAPIProvider\(\)\s*\]' --type=ts

Repository: codeaashu/claude-code

Length of output: 47


🏁 Script executed:

#!/bin/bash
# Check the actual ModelConfig type and config instances in configs.ts
echo "=== Checking src/utils/model/configs.ts ==="
wc -l src/utils/model/configs.ts

Repository: codeaashu/claude-code

Length of output: 139


🏁 Script executed:

#!/bin/bash
# Read the ModelConfig type definition and context around lines 3-4
head -n 20 src/utils/model/configs.ts

Repository: codeaashu/claude-code

Length of output: 855


🏁 Script executed:

#!/bin/bash
# Read the teamMateModel.ts file to check the actual code
cat -n src/utils/swarm/teammateModel.ts | head -n 30

Repository: codeaashu/claude-code

Length of output: 609


🏁 Script executed:

#!/bin/bash
# Search for actual config access patterns without the regex anchors
rg 'CONFIG\[getAPIProvider' --type=ts -A 2 -B 2

Repository: codeaashu/claude-code

Length of output: 369


🏁 Script executed:

#!/bin/bash
# Find all places where getAPIProvider is used with config access
rg 'getAPIProvider\(\)' --type=ts -B 2 -A 2 | head -n 100

Repository: codeaashu/claude-code

Length of output: 5774


🏁 Script executed:

#!/bin/bash
# Find the getAPIProvider function implementation
rg 'export.*getAPIProvider' --type=ts -A 5

Repository: codeaashu/claude-code

Length of output: 932


🏁 Script executed:

#!/bin/bash
# Search for minimax in the configs file to see if any minimax configs were added
rg 'minimax' src/utils/model/configs.ts -i -A 2 -B 2

Repository: codeaashu/claude-code

Length of output: 1017


🏁 Script executed:

#!/bin/bash
# Check what values getAPIProvider() can return
rg "type.*Provider|'minimax'|'firstParty'|'bedrock'" src/utils/model/providers.ts --type=ts | head -n 50

Repository: codeaashu/claude-code

Length of output: 253


🏁 Script executed:

#!/bin/bash
# Look for calls to getHardcodedTeammateModelFallback to see if it's guarded
rg 'getHardcodedTeammateModelFallback' --type=ts -B 3 -A 3

Repository: codeaashu/claude-code

Length of output: 3484


Runtime error: direct config access returns undefined for MiniMax provider.

Making minimax optional in ModelConfig creates a type mismatch. While MiniMax configs include the minimax key, existing Claude configs (e.g., CLAUDE_OPUS_4_6_CONFIG) do not. When getAPIProvider() returns 'minimax', accessing CLAUDE_OPUS_4_6_CONFIG['minimax'] returns undefined, violating the declared string return type.

This affects getHardcodedTeammateModelFallback() in src/utils/swarm/teammateModel.ts:9:

export function getHardcodedTeammateModelFallback(): string {
  return CLAUDE_OPUS_4_6_CONFIG[getAPIProvider()]  // undefined for minimax
}

Add minimax entries to all Claude configs or use fallback logic: config[provider] ?? config.firstParty.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/utils/model/configs.ts` around lines 3 - 4, ModelConfig currently makes
'minimax' optional which causes CLAUDE_OPUS_4_6_CONFIG[getAPIProvider()] to be
undefined when getAPIProvider() returns 'minimax', breaking
getHardcodedTeammateModelFallback; fix by ensuring a defined fallback or adding
minimax entries: either add a 'minimax' key to all Claude configs (e.g.,
CLAUDE_OPUS_4_6_CONFIG) with the appropriate ModelName, or change
getHardcodedTeammateModelFallback to safely resolve provider like const provider
= getAPIProvider(); return CLAUDE_OPUS_4_6_CONFIG[provider] ??
CLAUDE_OPUS_4_6_CONFIG.firstParty so it never returns undefined. Ensure
references to ModelConfig, minimax, CLAUDE_OPUS_4_6_CONFIG and
getHardcodedTeammateModelFallback are updated accordingly.

import { isEnvTruthy } from '../envUtils.js'

export type APIProvider = 'firstParty' | 'bedrock' | 'vertex' | 'foundry'
export type APIProvider = 'firstParty' | 'bedrock' | 'vertex' | 'foundry' | 'minimax'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find all places that check getAPIProvider() for specific provider strings
rg -n "getAPIProvider\(\)" --type=ts -A3 | rg -B1 "(firstParty|bedrock|vertex|foundry)" | head -60

Repository: codeaashu/claude-code

Length of output: 2237


🏁 Script executed:

#!/bin/bash
# Check betas.ts around the structured outputs section (line 140-155)
sed -n '140,160p' src/utils/betas.ts

Repository: codeaashu/claude-code

Length of output: 965


🏁 Script executed:

#!/bin/bash
# Check thinking.ts around the claimed lines (95-110 and 138-144)
sed -n '95,115p' src/utils/thinking.ts
echo "---"
sed -n '135,150p' src/utils/thinking.ts

Repository: codeaashu/claude-code

Length of output: 1667


🏁 Script executed:

#!/bin/bash
# Search WebSearchTool.ts for provider checks
rg -n "getAPIProvider\|provider" src/tools/WebSearchTool/WebSearchTool.ts | head -30

Repository: codeaashu/claude-code

Length of output: 47


🏁 Script executed:

#!/bin/bash
# Read WebSearchTool.ts to find provider checks
wc -l src/tools/WebSearchTool/WebSearchTool.ts

Repository: codeaashu/claude-code

Length of output: 109


🏁 Script executed:

#!/bin/bash
# Search for provider checks in WebSearchTool.ts
grep -n "provider\|getAPIProvider\|minimax\|bedrock\|vertex\|foundry" src/tools/WebSearchTool/WebSearchTool.ts

Repository: codeaashu/claude-code

Length of output: 286


🏁 Script executed:

#!/bin/bash
# Read WebSearchTool.ts around the provider checks
sed -n '160,195p' src/tools/WebSearchTool/WebSearchTool.ts

Repository: codeaashu/claude-code

Length of output: 975


Feature capability checks don't handle 'minimax' provider.

Several functions in the codebase check for specific providers to enable features but don't handle 'minimax':

  • src/tools/WebSearchTool/WebSearchTool.ts:173, 178, 188 — web search disabled (only enables for firstParty, vertex, and foundry; defaults to false for minimax)
  • src/utils/betas.ts:146 — structured outputs disabled (explicit check: if (provider !== 'firstParty' && provider !== 'foundry') return false)
  • src/utils/thinking.ts:142-143 — adaptive thinking disabled (only enabled for firstParty and foundry)

If MiniMax supports these features via their Anthropic-compatible API, users will experience silent feature degradation. If intentional, add explicit documentation and graceful UI handling for unsupported features.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/utils/model/providers.ts` at line 4, The APIProvider union lacks
'minimax' handling leading to silent feature disablement; update all provider
checks to explicitly include or exclude 'minimax' so behavior is deterministic:
in src/tools/WebSearchTool/WebSearchTool.ts update the feature gating (the logic
around web search enablement) to either include 'minimax' alongside
'firstParty', 'vertex', and 'foundry' if MiniMax supports web search, or
explicitly handle minimax by returning false with a clear comment and a
UI-facing flag; in src/utils/betas.ts (structured outputs check) and
src/utils/thinking.ts (adaptive thinking check) modify the conditional logic
that currently checks provider against 'firstParty' and 'foundry' to also
consider 'minimax' where appropriate, or add explicit negative branches for
'minimax' plus a comment and a hook to surface unsupported-state to the UI; make
sure to reference the APIProvider type so changes stay consistent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant